home *** CD-ROM | disk | FTP | other *** search
- Path: lrz-muenchen.de!news
- From: watzka@stat.uni-muenchen.de (Kurt Watzka)
- Newsgroups: comp.lang.c
- Subject: Re: malloc question
- Date: 7 Apr 1996 08:59:45 GMT
- Organization: Leibniz-Rechenzentrum, Muenchen (Germany)
- Distribution: world
- Message-ID: <4k8061$l5@sparcserver.lrz-muenchen.de>
- References: <4k6tgn$13c8@pulp.ucs.ualberta.ca>
- NNTP-Posting-Host: sun2.lrz-muenchen.de
-
- hcolquho@gpu3.srv.ualberta.ca (Harry Colquhoun) writes:
-
- >Not quite sure what's happening here, most likely something real stupid I
- >did, I'm sure.
-
- >compiled using djgpp under MSDOS->works fine
- >compiled using djgpp on SGI->core dump
-
- >-------------------------
- >global variable 'frames'
-
- >the problem:
-
- >unsigned long int *mem;
- >mem = (unsigned long int *) malloc (frames);
- >-------------------------
-
- >changing to 'unsigned long int mem[100]' and no malloc fixes problem
-
-
- >Anyone know why?
-
- Because "works fine" is a DOS expression for "does not diagnose a
- horrible error".
-
- Try:
-
- mem = malloc(frames * sizeof(*mem));
-
- Kurt
- --
- | Kurt Watzka Phone : +49-89-2180-6254
- | watzka@stat.uni-muenchen.de
-